<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: ViewModelsGenerator
  
    &mdash; Documentation by YARD 0.8.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '';
  framesUrl = "frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (V)</a> &raquo;
    
    
    <span class="title">ViewModelsGenerator</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: ViewModelsGenerator
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Rails::Generators::Base</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Rails::Generators::Base</li>
          
            <li class="next">ViewModelsGenerator</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/rails/generators/view_models/view_models_generator.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>A generator for view models</p>


  </div>
</div>
<div class="tags">
  

</div>






  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#create_model-instance_method" title="#create_model (instance method)">- (Object) <strong>create_model</strong>(class_name, file_name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Create the view model files for the view models given.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#create_views-instance_method" title="#create_views (instance method)">- (Object) <strong>create_views</strong>(file_name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Create views corresponding to view models.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#generate_view_models-instance_method" title="#generate_view_models (instance method)">- (Object) <strong>generate_view_models</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Generate the view models given.</p>
</div></span>
  
</li>

      
    </ul>
  


  

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="create_model-instance_method">
  
    - (<tt>Object</tt>) <strong>create_model</strong>(class_name, file_name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Create the view model files for the view models given</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rails/generators/view_models/view_models_generator.rb', line 34</span>

<span class='kw'>def</span> <span class='id identifier rubyid_create_model'>create_model</span> <span class='id identifier rubyid_class_name'>class_name</span><span class='comma'>,</span> <span class='id identifier rubyid_file_name'>file_name</span>
  <span class='comment'># ViewModels
</span>  <span class='comment'>#
</span>  <span class='id identifier rubyid_create_file'>create_file</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>app/view_models/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_name'>file_name</span><span class='rbrace'>}</span><span class='tstring_content'>.rb</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='heredoc_beg'>&lt;&lt;-FILE</span>
<span class='tstring_content'>class ViewModels::</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_class_name'>class_name</span><span class='rbrace'>}</span><span class='tstring_content'> &lt; ViewModels::Project

# model_reader :icon, :filter_through =&gt; [:h]

end
</span><span class='heredoc_end'>  FILE
</span>
  <span class='comment'># Specs
</span>  <span class='comment'>#
</span>  
  <span class='id identifier rubyid_create_file'>create_file</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>spec/view_models/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_name'>file_name</span><span class='rbrace'>}</span><span class='tstring_content'>_spec.rb</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='heredoc_beg'>&lt;&lt;-FILE</span>
<span class='tstring_content'>require 'spec_helper'

</span><span class='embexpr_beg'>describe ViewModels::#{</span><span class='id identifier rubyid_class_name'>class_name</span><span class='rbrace'>}</span><span class='tstring_content'> do

end
</span><span class='heredoc_end'>  FILE
</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="create_views-instance_method">
  
    - (<tt>Object</tt>) <strong>create_views</strong>(file_name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Create views corresponding to view models</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


20
21
22
23
24
25
26
27
28
29
30</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rails/generators/view_models/view_models_generator.rb', line 20</span>

<span class='kw'>def</span> <span class='id identifier rubyid_create_views'>create_views</span> <span class='id identifier rubyid_file_name'>file_name</span>
  <span class='words_beg'>%W(</span><span class='tstring_content'>list_item</span><span class='words_sep'> </span><span class='tstring_content'>main_item</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_view'>view</span><span class='op'>|</span>
    <span class='id identifier rubyid_create_file'>create_file</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>app/views/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_name'>file_name</span><span class='period'>.</span><span class='id identifier rubyid_pluralize'>pluralize</span><span class='rbrace'>}</span><span class='tstring_content'>/_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_view'>view</span><span class='rbrace'>}</span><span class='tstring_content'>.html.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_views'>views</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>../templates</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/views/_empty.html.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_views'>views</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy collection views.
</span>  <span class='comment'>#
</span>  <span class='words_beg'>%W(</span><span class='tstring_content'>collection</span><span class='words_sep'> </span><span class='tstring_content'>list</span><span class='words_sep'> </span><span class='tstring_content'>pagination</span><span class='words_sep'> </span><span class='tstring_content'>table</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_view'>view</span><span class='op'>|</span>
    <span class='id identifier rubyid_create_file'>create_file</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>app/views/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_name'>file_name</span><span class='period'>.</span><span class='id identifier rubyid_pluralize'>pluralize</span><span class='rbrace'>}</span><span class='tstring_content'>/_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_view'>view</span><span class='rbrace'>}</span><span class='tstring_content'>.html.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_views'>views</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>../templates</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/views/_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_view'>view</span><span class='rbrace'>}</span><span class='tstring_content'>.html.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_views'>views</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="generate_view_models-instance_method">
  
    - (<tt>Object</tt>) <strong>generate_view_models</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Generate the view models given</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


10
11
12
13
14
15
16</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rails/generators/view_models/view_models_generator.rb', line 10</span>

<span class='kw'>def</span> <span class='id identifier rubyid_generate_view_models'>generate_view_models</span>
  <span class='id identifier rubyid_file_name'>file_name</span> <span class='op'>=</span> <span class='id identifier rubyid_class_name'>class_name</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
  
  <span class='id identifier rubyid_create_model'>create_model</span> <span class='id identifier rubyid_class_name'>class_name</span><span class='comma'>,</span> <span class='id identifier rubyid_file_name'>file_name</span>
  
  <span class='id identifier rubyid_create_views'>create_views</span> <span class='id identifier rubyid_file_name'>file_name</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_views'>views</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Tue Oct 16 23:27:35 2012 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.3 (ruby-1.9.3).
</div>

  </body>
</html>